var __extends =
    (this && this.__extends) ||
    (function () {
      var e = function (t, a) {
        return (e =
          Object.setPrototypeOf ||
          ({ __proto__: [] } instanceof Array &&
            function (e, t) {
              e.__proto__ = t;
            }) ||
          function (e, t) {
            for (var a in t)
              Object.prototype.hasOwnProperty.call(t, a) && (e[a] = t[a]);
          })(t, a);
      };
      return function (t, a) {
        function i() {
          this.constructor = t;
        }
        if ("function" != typeof a && null !== a)
          throw new TypeError(
            "Class extends value " + String(a) + " is not a constructor or null"
          );
        e(t, a),
          (t.prototype =
            null === a
              ? Object.create(a)
              : ((i.prototype = a.prototype), new i()));
      };
    })(),
  AXFlyMyMarketView = (function (e) {
    function t(t, a) {
      var i = e.call(this) || this;
      return (
        (i.onOtherMarketDatFn = {
          caller: i,
          code: 1032,
          method: function (e) {
            if (0 != e.code)
              return (
                1 == i.buyType && ToastView.toastView(e.msg),
                (i.btn_market_deleteOne.visible = !1),
                (i.btn_market_deleteTwo.visible = !1),
                (i.btn_market_deleteThree.visible = !1),
                (i.btn_market_deleteFour.visible = !1),
                void (i.btn_market_deleteFive.visible = !1)
              );
            (i.lbl_tanweiName.text = e.data.name),
              1 == e.data.state && (i.lbl_myMarketState.text = "正在出售"),
              2 == e.data.type
                ? ((i.lbl_myMarketState.text =
                    "打包(" + e.data.money + "银)出售"),
                  (i.lbl_myMarketState.visible = !0),
                  (i.btn_fabutanwei.label = "打包购买"),
                  (i.btn_fabutanwei.visible = !0))
                : (i.btn_fabutanwei.visible = !1);
            var t;
            "my" == i.market_direct
              ? (t = "删除")
              : "other" == i.market_direct && (t = "购买");
            var a;
            (a = e.data.things), (i.arrData = a);
            for (var l = 0; l < a.length; l++)
              if (0 == l)
                if (null == a[l])
                  (i.btn_market_selectOne.visible = !1),
                    (i.btn_market_deleteOne.visible = !1),
                    (i.lbl_name_one.text = "[空]");
                else {
                  (i.btn_market_selectOne.visible = !1),
                    (i.btn_market_deleteOne.visible = !0),
                    (i.btn_market_deleteOne.label = t),
                    (i.image_market_one.visible = !0);
                  var n = a[l].count,
                    r = (a[l].lvl, a[l].money + " 银"),
                    _ = a[l].thing_type;
                  2 == e.data.type
                    ? (i.btn_market_deleteOne.visible = !1)
                    : (i.btn_market_deleteOne.visible = !0),
                    (i.lbl_name_one.text =
                      1 == _ || 4 == _ || 7 == _
                        ? a[l].name + "  (" + n + "个) " + r
                        : a[l].name + r);
                }
              else if (1 == l)
                if (null == a[l])
                  (i.btn_market_selectTwo.visible = !1),
                    (i.btn_market_deleteTwo.visible = !1),
                    (i.image_market_two.skin = ""),
                    (i.lbl_name_two.text = "[空]");
                else {
                  (i.btn_market_selectTwo.visible = !1),
                    (i.btn_market_deleteTwo.visible = !0),
                    (i.btn_market_deleteTwo.label = t),
                    (i.image_market_two.visible = !0);
                  var n = a[l].count,
                    r = (a[l].lvl, a[l].money + " 银"),
                    _ = a[l].thing_type;
                  2 == e.data.type
                    ? (i.btn_market_deleteTwo.visible = !1)
                    : (i.btn_market_deleteTwo.visible = !0),
                    (i.lbl_name_two.text =
                      1 == _ || 4 == _ || 7 == _
                        ? a[l].name + "  (" + n + "个) " + r
                        : a[l].name + r);
                }
              else if (2 == l)
                if (null == a[l])
                  (i.btn_market_selectThree.visible = !1),
                    (i.btn_market_deleteThree.visible = !1),
                    (i.image_market_three.skin = ""),
                    (i.lbl_name_three.text = "[空]");
                else {
                  (i.btn_market_selectThree.visible = !1),
                    (i.btn_market_deleteThree.visible = !0),
                    (i.btn_market_deleteThree.label = t),
                    (i.image_market_three.visible = !0);
                  var n = a[l].count,
                    r = (a[l].lvl, a[l].money + " 银"),
                    _ = a[l].thing_type;
                  2 == e.data.type
                    ? (i.btn_market_deleteThree.visible = !1)
                    : (i.btn_market_deleteThree.visible = !0),
                    (i.lbl_name_three.text =
                      1 == _ || 4 == _ || 7 == _
                        ? a[l].name + "  (" + n + "个) " + r
                        : a[l].name + r);
                }
              else if (3 == l)
                if (null == a[l])
                  (i.btn_market_selectFour.visible = !1),
                    (i.btn_market_deleteFour.visible = !1),
                    (i.image_market_four.skin = ""),
                    (i.lbl_name_four.text = "[空]");
                else {
                  (i.btn_market_selectFour.visible = !1),
                    (i.btn_market_deleteFour.visible = !0),
                    (i.btn_market_deleteFour.label = t),
                    (i.image_market_four.visible = !0);
                  var n = a[l].count,
                    r = (a[l].lvl, a[l].money + " 银"),
                    _ = a[l].thing_type;
                  2 == e.data.type
                    ? (i.btn_market_deleteFour.visible = !1)
                    : (i.btn_market_deleteFour.visible = !0),
                    (i.lbl_name_four.text =
                      1 == _ || 4 == _ || 7 == _
                        ? a[l].name + "  (" + n + "个) " + r
                        : a[l].name + r);
                }
              else if (4 == l)
                if (null == a[l])
                  (i.btn_market_selectFive.visible = !1),
                    (i.btn_market_deleteFive.visible = !1),
                    (i.image_market_five.skin = ""),
                    (i.lbl_name_five.text = "[空]");
                else {
                  (i.btn_market_selectFive.visible = !1),
                    (i.btn_market_deleteFive.visible = !0),
                    (i.btn_market_deleteFive.label = t),
                    (i.image_market_five.visible = !0);
                  var n = a[l].count,
                    r = (a[l].lvl, a[l].money + " 银"),
                    _ = a[l].thing_type;
                  2 == e.data.type
                    ? (i.btn_market_deleteFive.visible = !1)
                    : (i.btn_market_deleteFive.visible = !0),
                    (i.lbl_name_five.text =
                      1 == _ || 4 == _ || 7 == _
                        ? a[l].name + "  (" + n + "个) " + r
                        : a[l].name + r);
                }
          },
        }),
        (i.onMyMarketDatFn = {
          caller: i,
          code: 1311,
          method: function (e) {
            if (0 != e.code)
              (i.btn_market_deleteOne.visible = !1),
                (i.btn_market_deleteTwo.visible = !1),
                (i.btn_market_deleteThree.visible = !1),
                (i.btn_market_deleteFour.visible = !1),
                (i.btn_market_deleteFive.visible = !1);
            else {
              (i.lbl_tanweiName.text = e.data.name),
                (i.myStallDict = e.data),
                0 == e.data.state && (i.lbl_myMarketState.text = "正在编辑"),
                1 == e.data.state && (i.lbl_myMarketState.text = "正在出售"),
                2 == e.data.type
                  ? ((i.lbl_myMarketState.text =
                      "打包(" + e.data.money + "银)出售"),
                    (i.lbl_myMarketState.visible = !0),
                    (i.text_dabaoPrice.visible = !1),
                    (i.btn_fabutanwei.label = "撤销打包"))
                  : ((i.text_dabaoPrice.visible = !0),
                    (i.btn_fabutanwei.label = "打包发布"));
              var t = void 0;
              "my" == i.market_direct
                ? (t = "删除")
                : "other" == i.market_direct && (t = "购买");
              var a = void 0;
              (a = e.data.things), (i.arrData = a);
              for (var l = 0; l < a.length; l++)
                if (0 == l)
                  if (null == a[l])
                    (i.btn_market_selectOne.visible = !0),
                      (i.btn_market_deleteOne.visible = !1),
                      (i.image_market_one.skin = ""),
                      (i.lbl_name_one.text = "[空]");
                  else {
                    i.btn_market_selectOne.visible = !1;
                    var n = a[l].count,
                      r = (a[l].lvl, a[l].money + " 银"),
                      _ = a[l].thing_type;
                    2 == e.data.type
                      ? ((r = ""),
                        (i.btn_market_deleteOne.visible = !1),
                        (i.btn_market_deleteOne.label = ""))
                      : ((i.btn_market_deleteOne.visible = !0),
                        (i.btn_market_deleteOne.label = t)),
                      (i.lbl_name_one.text =
                        1 == _ || 4 == _ || 7 == _
                          ? a[l].name + "(" + n + ")" + r
                          : a[l].name + r);
                  }
                else if (1 == l)
                  if (null == a[l])
                    (i.btn_market_selectTwo.visible = !0),
                      (i.btn_market_deleteTwo.visible = !1),
                      (i.image_market_two.skin = ""),
                      (i.lbl_name_two.text = "[空]");
                  else {
                    (i.btn_market_selectTwo.visible = !1),
                      (i.btn_market_deleteTwo.visible = !0),
                      (i.image_market_two.visible = !0),
                      (i.btn_market_deleteTwo.label = t);
                    var n = a[l].count,
                      r = (a[l].lvl, a[l].money + " 银"),
                      _ = a[l].thing_type;
                    2 == e.data.type
                      ? ((r = ""),
                        (i.btn_market_deleteTwo.visible = !1),
                        (i.btn_market_deleteTwo.label = ""))
                      : ((i.btn_market_deleteTwo.visible = !0),
                        (i.btn_market_deleteTwo.label = t)),
                      (i.lbl_name_two.text =
                        1 == _ || 4 == _ || 7 == _
                          ? a[l].name + "(" + n + ")" + r
                          : a[l].name + r);
                  }
                else if (2 == l)
                  if (null == a[l])
                    (i.btn_market_selectThree.visible = !0),
                      (i.btn_market_deleteThree.visible = !1),
                      (i.image_market_three.skin = ""),
                      (i.lbl_name_three.text = "[空]");
                  else {
                    (i.btn_market_selectThree.visible = !1),
                      (i.btn_market_deleteThree.visible = !0),
                      (i.image_market_three.visible = !0),
                      (i.btn_market_deleteThree.label = t);
                    var n = a[l].count,
                      r = (a[l].lvl, a[l].money + " 银"),
                      _ = a[l].thing_type;
                    2 == e.data.type
                      ? ((r = ""),
                        (i.btn_market_deleteThree.visible = !1),
                        (i.btn_market_deleteThree.label = ""))
                      : ((i.btn_market_deleteThree.visible = !0),
                        (i.btn_market_deleteThree.label = t)),
                      (i.lbl_name_three.text =
                        1 == _ || 4 == _ || 7 == _
                          ? a[l].name + "(" + n + ")" + r
                          : a[l].name + r);
                  }
                else if (3 == l)
                  if (null == a[l])
                    (i.btn_market_selectFour.visible = !0),
                      (i.btn_market_deleteFour.visible = !1),
                      (i.image_market_four.skin = ""),
                      (i.lbl_name_four.text = "[空]");
                  else {
                    (i.btn_market_selectFour.visible = !1),
                      (i.btn_market_deleteFour.visible = !0),
                      (i.image_market_four.visible = !0),
                      (i.btn_market_deleteFour.label = t);
                    var n = a[l].count,
                      r = (a[l].lvl, a[l].money + " 银"),
                      _ = a[l].thing_type;
                    2 == e.data.type
                      ? ((r = ""),
                        (i.btn_market_deleteFour.visible = !1),
                        (i.btn_market_deleteFour.label = ""))
                      : ((i.btn_market_deleteFour.visible = !0),
                        (i.btn_market_deleteFour.label = t)),
                      (i.lbl_name_four.text =
                        1 == _ || 4 == _ || 7 == _
                          ? a[l].name + "(" + n + ")" + r
                          : a[l].name + r);
                  }
                else if (4 == l)
                  if (null == a[l])
                    (i.btn_market_selectFive.visible = !0),
                      (i.btn_market_deleteFive.visible = !1),
                      (i.image_market_five.skin = ""),
                      (i.lbl_name_five.text = "[空]");
                  else {
                    (i.btn_market_selectFive.visible = !1),
                      (i.btn_market_deleteFive.visible = !0),
                      (i.image_market_five.visible = !0),
                      (i.btn_market_deleteFive.label = t);
                    var n = a[l].count,
                      r = (a[l].lvl, a[l].money + " 银"),
                      _ = a[l].thing_type;
                    2 == e.data.type
                      ? ((r = ""),
                        (i.btn_market_deleteFive.visible = !1),
                        (i.btn_market_deleteFive.label = ""))
                      : ((i.btn_market_deleteFive.visible = !0),
                        (i.btn_market_deleteFive.label = t)),
                      (i.lbl_name_five.text =
                        1 == _ || 4 == _ || 7 == _
                          ? a[l].name + "(" + n + ")" + r
                          : a[l].name + r);
                  }
            }
          },
        }),
        (i.onLoadPitchDataListFn = {
          caller: i,
          code: 1318,
          method: function (e) {
            0 == e.code
              ? (WebSocketService.send({
                  c: 1264,
                  d: { type: i.tab_type, pageNum: 0 },
                }),
                i.refreshCurrentMarketUIData(),
                (i.lbl_myMarketState.text = "正在出售"),
                ToastView.toastView("发布成功"))
              : ToastView.toastView(e.msg);
          },
        }),
        (i.onDeletePitchDataListFn = {
          caller: i,
          code: 1317,
          method: function (e) {
            0 == e.code &&
              (ToastView.toastView("删除成功"),
              WebSocketService.send({ c: 1311, d: null }),
              WebSocketService.send({
                c: 1264,
                d: { type: i.tab_type, pageNum: 0 },
              }));
          },
        }),
        i.btn_myFly_back.on(Laya.Event.CLICK, i, i.onFlyBackPreFn),
        WebSocketService.addListener(i.onMyMarketDatFn),
        WebSocketService.addListener(i.onOtherMarketDatFn),
        i.lbl_tanweiName.on(Laya.Event.CLICK, i, i.onDidTanWeiNameAction),
        i.btn_market_selectOne.on(Laya.Event.CLICK, i, i.onMarketSelectFn),
        i.btn_market_selectTwo.on(Laya.Event.CLICK, i, i.onMarketSelectFn),
        i.btn_market_selectThree.on(Laya.Event.CLICK, i, i.onMarketSelectFn),
        i.btn_market_selectFour.on(Laya.Event.CLICK, i, i.onMarketSelectFn),
        i.btn_market_selectFive.on(Laya.Event.CLICK, i, i.onMarketSelectFn),
        i.btn_market_deleteOne.on(Laya.Event.CLICK, i, i.onMarketDeleteFn),
        i.btn_market_deleteTwo.on(Laya.Event.CLICK, i, i.onMarketDeleteFn),
        i.btn_market_deleteThree.on(Laya.Event.CLICK, i, i.onMarketDeleteFn),
        i.btn_market_deleteFour.on(Laya.Event.CLICK, i, i.onMarketDeleteFn),
        i.btn_market_deleteFive.on(Laya.Event.CLICK, i, i.onMarketDeleteFn),
        i.btn_modifyShopName.on(Laya.Event.CLICK, i, i.onGengGaiTanMingFn),
        i.btn_fabutanwei.on(Laya.Event.CLICK, i, i.onTakePicthSeatedFn),
        i.lbl_name_one.on(
          Laya.Event.CLICK,
          i,
          i.onDidClickLookThingDetailAction
        ),
        i.lbl_name_two.on(
          Laya.Event.CLICK,
          i,
          i.onDidClickLookThingDetailAction
        ),
        i.lbl_name_three.on(
          Laya.Event.CLICK,
          i,
          i.onDidClickLookThingDetailAction
        ),
        i.lbl_name_four.on(
          Laya.Event.CLICK,
          i,
          i.onDidClickLookThingDetailAction
        ),
        i.lbl_name_five.on(
          Laya.Event.CLICK,
          i,
          i.onDidClickLookThingDetailAction
        ),
        WebSocketService.addListener(i.onLoadPitchDataListFn),
        WebSocketService.addListener(i.onDeletePitchDataListFn),
        WebSocketService.addListener({
          caller: i,
          code: 2098,
          method: i.onLoadThingFuJiangDetailFn,
        }),
        WebSocketService.addListener({
          caller: i,
          code: 1329,
          method: i.onLoadBuyFuJiangDataFn,
        }),
        i
      );
    }
    return (
      __extends(t, e),
      (t.openModifyView = function (e, a, i) {
        return (
          null == this.flyMyMarVC && (this.flyMyMarVC = new t(e, a)),
          (this.flyMyMarVC.stallId = a),
          a == Global.roleId && (e = "my"),
          (this.flyMyMarVC.myStallDict = null),
          (this.flyMyMarVC.otherStallDict = null),
          (this.flyMyMarVC.buyType = !1),
          (this.flyMyMarVC.market_direct = e),
          (this.flyMyMarVC.text_dabaoPrice.text = ""),
          "my" == e
            ? ((this.flyMyMarVC.lbl_tanweiName.text =
                Global.roleName + " 的摊位"),
              (this.flyMyMarVC.btn_modifyShopName.visible = !0),
              (this.flyMyMarVC.btn_fabutanwei.visible = !0),
              (this.flyMyMarVC.lbl_dabaoTitle.visible = !0),
              WebSocketService.send({ c: 1311, d: null }),
              (this.flyMyMarVC.tab_type = i))
            : "other" == e &&
              ((this.flyMyMarVC.btn_modifyShopName.visible = !1),
              (this.flyMyMarVC.btn_fabutanwei.visible = !1),
              (this.flyMyMarVC.lbl_dabaoTitle.visible = !1),
              (this.flyMyMarVC.text_dabaoPrice.visible = !1),
              WebSocketService.send({ c: 1032, d: { stallId: a } })),
          (this.flyMyMarVC.curClsState = !0),
          this.flyMyMarVC
        );
      }),
      (t.prototype.onGengGaiTanMingFn = function () {
        AXAlertView.alertOpen("");
      }),
      (t.prototype.onMarketSelectFn = function (e) {
        var t;
        e.target == this.btn_market_selectOne
          ? (t = 0)
          : e.target == this.btn_market_selectTwo
          ? (t = 1)
          : e.target == this.btn_market_selectThree
          ? (t = 2)
          : e.target == this.btn_market_selectFour
          ? (t = 3)
          : e.target == this.btn_market_selectFive && (t = 4),
          MTPitchItemView.openView(t);
      }),
      (t.prototype.initMyStallMarketUI = function () {
        (this.btn_market_selectOne.visible = !0),
          (this.btn_market_deleteOne.visible = !1),
          (this.image_market_one.skin = ""),
          (this.lbl_name_one.text = "[空]"),
          (this.btn_market_selectTwo.visible = !0),
          (this.btn_market_deleteTwo.visible = !1),
          (this.image_market_two.skin = ""),
          (this.lbl_name_two.text = "[空]"),
          (this.btn_market_selectThree.visible = !0),
          (this.btn_market_deleteThree.visible = !1),
          (this.image_market_three.skin = ""),
          (this.lbl_name_three.text = "[空]"),
          (this.btn_market_selectFour.visible = !0),
          (this.btn_market_deleteFour.visible = !1),
          (this.image_market_four.skin = ""),
          (this.lbl_name_four.text = "[空]"),
          (this.btn_market_selectFive.visible = !0),
          (this.btn_market_deleteFive.visible = !1),
          (this.image_market_five.skin = ""),
          (this.lbl_name_five.text = "[空]"),
          "my" == this.market_direct &&
            (this.btn_fabutanwei.label = "打包发布");
      }),
      (t.prototype.onTakePicthSeatedFn = function () {
        if ("my" == this.market_direct)
          if (2 == this.myStallDict.type)
            NormalDialog.showNormalDialog(
              "您确定要撤销摊位吗？",
              this,
              this.onLevalMarketAction
            );
          else {
            var e = 0;
            if (
              (this.text_dabaoPrice.text &&
                (e = parseFloat(this.text_dabaoPrice.text)),
              e >= 5e8)
            )
              return void Alert.openText("最高打包出售价格5亿银币");
            e > 0
              ? WebSocketService.send({ c: 1318, d: { money: e } })
              : WebSocketService.send({ c: 1318, d: { money: 0 } }),
              (this.text_dabaoPrice.text = "");
          }
        else
          NormalDialog.showNormalDialog(
            "您确定要打包购买吗？",
            this,
            this.onPackageBuyMarketAction
          );
      }),
      (t.prototype.onLevalMarketAction = function () {
        WebSocketService.send({ c: 1307, d: null }),
          (this.text_dabaoPrice.visible = !0),
          (this.lbl_myMarketState.visible = !1),
          this.refreshCurrentMarketUIData();
      }),
      (t.prototype.onPackageBuyMarketAction = function () {
        (this.buyType = !0),
          WebSocketService.send({
            c: 1329,
            d: { stallId: this.stallId, pos: 0, thingId: 0, count: 0 },
          }),
          this.initMyStallMarketUI();
      }),
      (t.prototype.refreshCurrentMarketUIData = function () {
        this.initMyStallMarketUI(),
          "my" == this.market_direct
            ? WebSocketService.send({ c: 1311, d: null })
            : WebSocketService.send({ c: 1032, d: { stallId: this.stallId } });
      }),
      (t.prototype.onMarketDeleteFn = function (e) {
        var t = e.target.label;
        if ("删除" == t) {
          var a = void 0;
          e.target == this.btn_market_deleteOne
            ? (a = 0)
            : e.target == this.btn_market_deleteTwo
            ? (a = 1)
            : e.target == this.btn_market_deleteThree
            ? (a = 2)
            : e.target == this.btn_market_deleteFour
            ? (a = 3)
            : e.target == this.btn_market_deleteFive && (a = 4),
            WebSocketService.send({ c: 1317, d: { pos: a } });
        } else if ("购买" == t) {
          var i = void 0;
          e.target == this.btn_market_deleteOne
            ? (i = 0)
            : e.target == this.btn_market_deleteTwo
            ? (i = 1)
            : e.target == this.btn_market_deleteThree
            ? (i = 2)
            : e.target == this.btn_market_deleteFour
            ? (i = 3)
            : e.target == this.btn_market_deleteFive && (i = 4);
          var l = {
            chargeID: this.stallId,
            thingID: this.arrData[i].thing_id,
            chargeSum: this.arrData[i].count,
            chargePos: i,
            chargeTitle: this.arrData[i].name,
            chargeMoney: this.arrData[i].money,
          };
          MTPitchChargeView.shoppingOpen(l);
        }
      }),
      (t.prototype.onDidClickLookThingDetailAction = function (e) {
        if ("[空]" != e.target.text) {
          var t = 0;
          "item0" == e.target.name
            ? (t = 0)
            : "item1" == e.target.name
            ? (t = 1)
            : "item2" == e.target.name
            ? (t = 2)
            : "item3" == e.target.name
            ? (t = 3)
            : "item4" == e.target.name && (t = 4),
            (this.selThingIndex = t + "");
          var a = this.arrData[t];
          if (3 == a.thing_type)
            WebSocketService.send({ c: 2098, d: { id: a.thing_id } });
          else {
            var i = {
              stallId: this.stallId,
              name: a.name,
              thing_id: a.thing_id,
              thing_type: a.thing_type,
              count: a.count,
              money: a.money,
              weight: a.weight,
              pos: t,
              type: this.market_direct,
            };
            DPItemDetailPageView.showItemDetailPageView(i, "AXFlyMyMarketView");
          }
        }
      }),
      (t.prototype.onLoadThingFuJiangDetailFn = function (e) {
        if (0 == e.code && this.curClsState) {
          var t = e.data,
            a = this.arrData[this.selThingIndex],
            i = {
              stallId: this.stallId,
              item: a,
              money: a.money,
              data: t,
              type: 2,
            };
          DPHeroDetailDialog.showHeroDetailDialog(i, "AXFlyMyMarketView");
        }
      }),
      (t.prototype.onLoadBuyFuJiangDataFn = function (e) {
        0 == e.code &&
          WebSocketService.send({ c: 1032, d: { stallId: this.stallId } }),
          ToastView.toastView(e.msg);
      }),
      (t.prototype.onDidTanWeiNameAction = function () {
        FriendsDetailDialog.showFriendDialog(this.stallId, !0);
      }),
      (t.prototype.onFlyBackPreFn = function () {
        (this.curClsState = !1), this.removeSelf();
      }),
      t
    );
  })(ui.MarketController.AXFlyMyMarketViewUI);
